<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="eee">
  <div>第一个字符串:<input v-model="frit"></div>
  <div>最后一个字符串:<input v-model="last"></div>
  <p>完整字符串:{{name}}</p>
  <p>最后一个字符串:{{last}}</p>
  <p>第一个字符串:{{frit}}</p>
</div>
<script>

  var asas =new Vue({
    el: '#eee',
    data: {
      frit: '222',
      last: '111'
    },
    computed: {
      name: {
        get: function() {
          return this.frit + '-' + this.last;
        },
        set: function(newVlue) {
          var names = newVlue.split('-');
          this.frit = names[0];
          this.last = names[names.length - 1];
        }
      }
    }
  });
</script>
</body>
</html>
